package com.wanxi.dangdang.controller;

import com.wanxi.dangdang.common.CommonResult;
import com.wanxi.dangdang.common.ResultCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: 吕永杰
 * @Description: 全局异常处理
 * @Date: Created in 2021/9/1
 * @Version: 1.0
 */
//@ControllerAdvice
public class GlobalExceptionHandler {
    @ResponseBody
    @ExceptionHandler(RuntimeException.class)
    public CommonResult handleCustomException(Exception e) {
        return CommonResult.failure(ResultCode.VALIDATE_FAILED);
    }
}
